# SPDX-License-Identifier: GPL-3.0+
import os, fnmatch

def find_files(directory, pattern):
    for root, dirs, files in os.walk(directory):
        for basename in files:
            if fnmatch.fnmatch(basename, pattern):
                filename = os.path.join(root, basename)
                yield filename

cp_old = "Copyright (C) 2013       HAL@ShurabaP  <https://github.com/haruneko>"
cp_new = "Copyright (C) 2010-2013  HAL@ShurabaP  <https://github.com/haruneko>"

def replace_copyright(filename,old,new):
	txt = open(filename).read()
	txt2 = txt.replace(old,new)
	open(filename+".bak","w").write(txt)
	open(filename,"w").write(txt2)
	
	
	

for filename in find_files('.', '*.cpp'):
    replace_copyright(filename,cp_old,cp_new)
    
for filename in find_files('.', '*.h'):
    replace_copyright(filename,cp_old,cp_new)
